Las Reliquias de Tolti Aph

An interactive fiction by Graham Nelson (2005) - the Inform 7 source text

Home page

Contents
Previous
Next

Complete text
Section 3(e) - Daño

The damage incurred is a number that varies.

Calculating damage modifiers of something is an activity.

For calculating damage modifiers of a person (called the defender):
    if the defender is wearing armour (called the protector) and the damage incurred is greater than 1
    begin;
        say ": [the protector] absorbe ";
        let the absorbency be the armour class of the protector;
        if the absorbency >= the damage incurred
        begin;
            let the absorbency be the damage incurred;
            decrease the absorbency by 1;
        end if;
        decrease the damage incurred by the absorbency;
        say the absorbency;
    end if;
    continue the activity.

For calculating damage modifiers of a person (called the defender):
    if the defender is affected by huesos de hierro and the damage incurred is greater than 1
    begin;
        say ": el hechizo huesos de hierro reduce el daño a la mitad";
        change the damage incurred to the damage incurred divided by 2;
    end if;
    continue the activity.

Dead body disposal of something is an activity.[1]

To make (defender - a person) take (hits - a number) points of damage:
    let the original hits be the hits;
    change the damage incurred to the hits;
    carry out the calculating damage modifiers activity with the defender;
    let the hits be the damage incurred;
    if the hits <= 0
    begin;
        say " - así que no hay daño.";
        stop;
    end if;
    if the original hits are not the hits, say ", dejando [hits] sin absorber";
    decrease the strength of the defender by the hits;
    if the defender is killed
    begin;
        say " - ¡un golpe fatal!";
        if the player is the defender begin;
            end the game saying "Has muerto en combate.";
            stop;
        end if;
        carry out the dead body disposal activity with the defender;
        if the defender is in the location, remove the defender from play;
        award the permanent strength of the defender points;
        repeat with the item running through things which are had by the defender
        begin;
            move the item to the location;
        end repeat;
    otherwise;
        if the player is the defender, say ", reduciendo tu vida a [strength of the player].";
        otherwise say ", disminuyendo la vida [del defender] a [strength of the defender].";
    end if.

Note

[1]. Esto se proporciona para beneficio de cualquier persona que use estas reglas para hacer algo especial con los cuerpos muertos, de otra forma se desvanecerían silenciosamente del campo de batalla.